import java.util.*;

/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 * 和 Main 解决的问题相同，只不过使用了 set
 */
@SuppressWarnings({"all"})
public class Main2 {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()){
            String s1 = in.nextLine();
            String s2 = in.nextLine();
            func(s1, s2);
        }
        in.close();
    }

    private static void func(String s1, String s2) {
        Set<Character> set = new HashSet<>();
        for (char c : s2.toUpperCase().toCharArray()) {
            set.add(c);
        }
        Set<Character> setBroken = new HashSet<>();
        for (char c : s1.toUpperCase().toCharArray()) {
            if (!setBroken.contains(c) && !set.contains(c)){ // 还未被打印，且缺失，则存入
                setBroken.add(c);
                System.out.print(c);
            }
        }
    }
}
